package com.chinacoal.microservice.controller;

import com.chinacoal.microservice.DataCenterClient;
import com.chinacoal.microservice.pojo.CcmsSmartleasingDeviceManagement;
import com.chinacoal.microservice.pojo.CcmsSmartleasingHistoricalPayment;
import com.chinacoal.microservice.pojo.CcmsSmartleasingRegionalAnalysis;
import com.chinacoal.microservice.pojo.DataCenter;
import com.chinacoal.microservice.service.DataCenterService;
import com.chinacoal.microservice.util.Result;
import com.chinacoal.microservice.util.UserLoginToken;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author zhuliang
 * @version V1.0
 * @Description: 数据中心和可视化页面-后端控制类
 * @date 2020-12-29 10：21
 */
@RestController
public class DataCenterController implements DataCenterClient {

    @Autowired
    private DataCenterService dataCenterService;

    /**
     * @Description: 费用概况
     * @author zhuliang
     * @date 2020/12/29 10:25
     */
    @Override
    @UserLoginToken
    public Result<DataCenter> costOverview() {
        return dataCenterService.costOverview();
    }

    /**
     * @Description: 得到综合分析数据
     * @author zhuliang
     * @date 2020/12/31 10:23
     */
    @Override
    @UserLoginToken
    public Result<List<CcmsSmartleasingHistoricalPayment>> getComprehensiveAnalysisData(String year, Integer type) {
        return dataCenterService.getComprehensiveAnalysisData(year, type);
    }

    /**
     * @Description: 得到区域分析数据
     * @author zhuliang
     * @date 2020/12/31 10:24
     */
    @Override
    @UserLoginToken
    public Result<List<CcmsSmartleasingRegionalAnalysis>> getAreaAnalysisData(Integer type) {
        return dataCenterService.getAreaAnalysisData(type);
    }

    /**
     * @Description: 得到房间面积数据
     * @author zhuliang
     * @date 2021/1/8 10:03
     */
    @Override
    @UserLoginToken
    public Result<DataCenter> getAreaData(Integer type) {
        return dataCenterService.getAreaData(type);
    }

    /**
     * @Description: 可视化页面房间统计数据
     * @author zhuliang
     * @date 2021/1/11 16:28
     */
    @Override
    @UserLoginToken
    public Result<List<CcmsSmartleasingDeviceManagement>> getVisualizationRoomData() {
        return dataCenterService.getVisualizationRoomData();
    }

    /**
     * @Description: 得到所有有记录的年份
     * @author zhuliang
     * @date 2021/1/15 16:21
     */
    @Override
    public Result<List<String>> getAllByYear() {
        return dataCenterService.getAllByYear();
    }

    /**
     * @Description: 可视化页面房间统计数据（右）
     * @author zhuliang
     * @date 2021/1/26 18:38
     */
    @Override
    public Result<CcmsSmartleasingDeviceManagement> getVisualizationStatisticalData() {
        return dataCenterService.getVisualizationStatisticalData();
    }
}
